%%This function will write a trc file in the proper format
function out = writetrc(filename,data,header,rate,numf,nummkr,oldrate)

% it will create a column for frame numbers and time
out = 'fail';
framecol = (1:numf);
timecol = (0:1/rate:numf/rate);

xlswrite(filename,header,1);
xlswrite(filename,framecol',1,'A7');
xlswrite(filename,timecol(1:numf)',1,'B7');
xlswrite(filename,'4',1,'B1');
xlswrite(filename,rate,1,'A3');
xlswrite(filename,rate,1,'B3');
xlswrite(filename,numf,1,'C3');
xlswrite(filename,nummkr,1,'D3');
xlswrite(filename,data,1,'C7');
xlswrite(filename,oldrate,1,'F3');
xlswrite(filename,'1',1,'G3');
xlswrite(filename,ceil(oldrate*numf/rate),1,'H3');
out = 'success';